import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "./assets/styles/common.css";
import "./assets/styles/icon/iconfont.css";
import utility from "../src/assets/js/utility";
import axios from "axios";
import echarts from "echarts";
import echartsGL from 'echarts-gl'
import VueParticles from "vue-particles";
import "xe-utils";
import VXETable from "vxe-table";
import "vxe-table/lib/style.css";
import Fragment from "vue-fragment";

Vue.use(Fragment.Plugin);

Vue.use(VXETable);
Vue.use(VueParticles);
Vue.prototype.utility = utility;
Vue.prototype.$echarts = echarts;
Vue.prototype.$echartsGL = echartsGL
Vue.config.productionTip = false;
Vue.use(ElementUI);

// 节流
const on = Vue.prototype.$on;
Vue.prototype.$on = function(event, func) {
    let previous = 0;
    let newFunc = func;
    if (event === "click") {
        newFunc = function() {
            const now = new Date().getTime();
            if (previous + 2000 <= now) {
                func.apply(this, arguments);
                previous = now;
            }
        };
    }
    on.call(this, event, newFunc);
};
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount("#app");